package cn.iocoder.yudao.module.alipay.dal.mysql.cpsactivity;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.cpsactivity.CpsActivityDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.cpsactivity.vo.*;

/**
 * cps活动 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CpsActivityMapper extends BaseMapperX<CpsActivityDO> {

    default PageResult<CpsActivityDO> selectPage(CpsActivityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CpsActivityDO>()
                .eqIfPresent(CpsActivityDO::getActiveCode, reqVO.getActiveCode())
                .eqIfPresent(CpsActivityDO::getActiveTitle, reqVO.getActiveTitle())
                .eqIfPresent(CpsActivityDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(CpsActivityDO::getActiveImg, reqVO.getActiveImg())
                .eqIfPresent(CpsActivityDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(CpsActivityDO::getPromotionId, reqVO.getPromotionId())
                .eqIfPresent(CpsActivityDO::getCommissionRate, reqVO.getCommissionRate())
                .betweenIfPresent(CpsActivityDO::getSettlementTime, reqVO.getSettlementTime())
                .eqIfPresent(CpsActivityDO::getSettlementCycle, reqVO.getSettlementCycle())
                .betweenIfPresent(CpsActivityDO::getActivityTime, reqVO.getActivityTime())
                .eqIfPresent(CpsActivityDO::getActivityDesc, reqVO.getActivityDesc())
                .eqIfPresent(CpsActivityDO::getAttributionLogic, reqVO.getAttributionLogic())
                .eqIfPresent(CpsActivityDO::getNote, reqVO.getNote())
                .eqIfPresent(CpsActivityDO::getSort, reqVO.getSort())
                .eqIfPresent(CpsActivityDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(CpsActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CpsActivityDO::getId));
    }

    default List<CpsActivityDO> selectList(CpsActivityExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CpsActivityDO>()
                .eqIfPresent(CpsActivityDO::getActiveCode, reqVO.getActiveCode())
                .eqIfPresent(CpsActivityDO::getActiveTitle, reqVO.getActiveTitle())
                .eqIfPresent(CpsActivityDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(CpsActivityDO::getActiveImg, reqVO.getActiveImg())
                .eqIfPresent(CpsActivityDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(CpsActivityDO::getPromotionId, reqVO.getPromotionId())
                .eqIfPresent(CpsActivityDO::getCommissionRate, reqVO.getCommissionRate())
                .betweenIfPresent(CpsActivityDO::getSettlementTime, reqVO.getSettlementTime())
                .eqIfPresent(CpsActivityDO::getSettlementCycle, reqVO.getSettlementCycle())
                .betweenIfPresent(CpsActivityDO::getActivityTime, reqVO.getActivityTime())
                .eqIfPresent(CpsActivityDO::getActivityDesc, reqVO.getActivityDesc())
                .eqIfPresent(CpsActivityDO::getAttributionLogic, reqVO.getAttributionLogic())
                .eqIfPresent(CpsActivityDO::getNote, reqVO.getNote())
                .eqIfPresent(CpsActivityDO::getSort, reqVO.getSort())
                .eqIfPresent(CpsActivityDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(CpsActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CpsActivityDO::getId));
    }

}
